1. Field of the Invention
This invention relates to a method of sub-band coding. In addition, this invention relates to a method of sub-band decoding. Furthermore, this invention relates to a sub-band coding apparatus and a sub-band decoding apparatus.
2. Description of the Related Art
Japanese published unexamined patent application 10-336038 discloses a method of encoding an audio signal which includes a step of separating the audio signal into signals in sub-bands. The resultant sub-band signals are encoded frame by frame. In general, scale factors are defined for the sub-band signals respectively. According to the method in Japanese application 10-336038, every frame is divided into a plurality of small frames, and scale factors are reduced in number by making some of them common to plural small frames. The encoding-resultant sub-band signals, and data representative of scale factors are combined into a bit stream. A 1-frame-corresponding portion of the bit stream is composed of a first area assigned to the data of scale factors, and second and later areas corresponding to the respective small frames and assigned to the encoding-resultant sub-band signals. Specifically, the second area is loaded with samples of the encoding-resultant sub-band signals which correspond to a first small frame. The later areas are loaded with samples of the encoding-resultant sub-band signals which correspond to second and later small frames.
According to the method in Japanese application 10-336038, even if scale factors remain unchanged over a plurality of successive frames, a given number of bits representing the scale factors are transmitted for every frame.
It is a first object of this invention to provide an improved method of sub-band coding.
It is a second object of this invention to provide an improved method of sub-band decoding.
It is a third object of this invention to provide an improved sub-band coding apparatus.
It is a fourth object of this invention to provide an improved sub-band decoding apparatus.
A first aspect of this invention provides a method of sub-band coding. The method comprises the steps of dividing an input digital audio signal into sub-band signals in respective sub-bands; determining scale factors of the respective sub-bands on the basis of the sub-band signals for every frame; calculating differences between the determined scale factors for a first frame and the determined scale factors for a second frame preceding the first frame; calculating absolute values of the calculated scale-factor differences and generating data representative of the calculated absolute values; encoding the data representative of the calculated absolute values into data of a Huffman code; generating sign bits representing signs of the calculated scale-factor differences; quantizing the sub-band signals in response to the determined scale factors for every frame to generate quantized samples of the sub-band signals; and combining the Huffman-code data, the generated sign bits, and the quantized samples of the sub-band signals into a bit stream.
A second aspect of this invention provides a method of sub-band coding. The method comprises the steps of dividing an input digital audio signal into sub-band signals in respective sub-bands; separating the sub-bands into groups on the basis of a perceptual model; determining scale factors of the respective sub-band groups on the basis of the sub-band signals for every frame; calculating differences between the determined scale factors for a first frame and the determined scale factors for a second frame preceding the first frame; calculating absolute values of the calculated scale-factor differences and generating data representative of the calculated absolute values; encoding the data representative of the calculated absolute values into data of a Huffman code; generating sign bits representing signs of the calculated scale-factor differences; quantizing the sub-band signals in response to the determined scale factors for every frame to generate quantized samples of the sub-band signals; and combining the Huffman-code data, the generated sign bits, and the quantized samples of the sub-band signals into a bit stream.
A third aspect of this invention provides a method of sub-band coding. The method comprises the steps of dividing an input digital audio signal into sub-band signals in respective sub-bands; determining scale factors of the respective sub-bands on the basis of the sub-band signals for every frame; calculating differences between the determined scale factors for a first frame and the determined scale factors for a second frame preceding the first frame; calculating absolute values of the calculated scale-factor differences and generating data representative of the calculated absolute values; encoding the data representative of the calculated absolute values into data of a Huffman code; generating sign bits representing signs of the calculated scale-factor differences; generating selection information representing a selected bit-stream format; quantizing the sub-band signals in response to the determined scale factors for every frame to generate quantized samples of the sub-band signals; combining the generated selection information, the Huffman-code data, the generated sign bits, and the quantized samples of the sub-band signals into a bit stream of a first format; generating information flags indicating whether or not the determined scale factors for the first frame are updated from the determined scale factors for the second frame, respectively; selecting one or more of the scale factors in the first frame which are updated from those in the second frame, and generating selected-scale-factor data representative of the selected scale factor or the selected scale factors; combining the generated selection information, the generated information flags, the selected-scale-factor data, and the quantized samples of the sub-band signals into a bit stream of a second format; and selecting one of the bit stream of the first format and the bit stream of the second format as an output bit stream to maximize a number of bits allocated to the samples of the sub-band signals.
A fourth aspect of this invention provides a method of sub-band coding. The method comprises the steps of dividing an input digital audio signal into sub-band signals in respective sub-bands; separating the sub-bands into groups on the basis of a perceptual model; determining scale factors of the respective sub-band groups on the basis of the sub-band signals for every frame; calculating differences between the determined scale factors for a first frame and the determined scale factors for a second frame preceding the first frame; calculating absolute values of the calculated scale-factor differences and generating data representative of the calculated absolute values; encoding the data representative of the calculated absolute values into data of a Huffman code; generating sign bits representing signs of the calculated scale-factor differences; generating selection information representing a selected bit-stream format; quantizing the sub-band signals in response to the determined scale factors for every frame to generate quantized samples of the sub-band signals; combining the generated selection information, the Huffman-code data, the generated sign bits, and the quantized samples of the sub-band signals into a bit stream of a first format; generating information flags indicating whether or not the determined scale factors for the first frame are updated from the determined scale factors for the second frame, respectively; selecting one or more of the scale factors in the first frame which are updated from those in the second frame, and generating selected-scale-factor data representative of the selected scale factor or the selected scale factors; combining the generated selection information, the generated information flags, the selected-scale-factor data, and the quantized samples of the sub-band signals into a bit stream of a second format; and selecting one of the bit stream of the first format and the bit stream of the second format as an output bit stream to maximize a number of bits allocated to the samples of the sub-band signals.
A fifth aspect of this invention is based on the first aspect thereof, and provides a method wherein the sign-bit generating step comprises preventing generation of a sign bit corresponding a calculated scale-factor difference which is equal to zero.
A sixth aspect of this invention is based on the first aspect thereof, and provides a method wherein the Huffman code is of a run-length type.
A seventh aspect of this invention is based on the first aspect thereof, and provides a method further comprising the step of fixing the determined scale factors to maximum values and preventing the determined scale factors from being updated during a predetermined time interval.
An eighth aspect of this invention provides a method of subtend decoding for a bit stream generated by the method in the first aspect of this invention. The method in the eighth aspect of this invention comprises the steps of extracting Huffman-code data from the bit stream; decoding the extracted Huffman-code data into data representative of absolute values of scale-factor differences; extracting sign bits from the bit stream; calculating scale factors of respective sub-bands on the basis of the extracted sign bits and the data representative of the absolute values of the scale-factor differences; deriving first sub-band signals in the respective sub-bands from the bit stream in response to the calculated scale factors; inversely quantizing the first sub-band signals into second sub-band signals in response to the calculated scale factors; and combining the second sub-band signals into an original digital audio signal.
A ninth aspect of this invention provides a method of sub-band decoding for a bit stream generated by the method in the second aspect of this invention. The method in the ninth aspect of this invention comprises the steps of extracting Huffman-code data from the bit stream; decoding the extracted Huffman-code data into data representative of absolute values of scale-factor differences; extracting sign bits from the bit stream; calculating scale factors of respective sub-band groups on the basis of the extracted sign bits and the data representative of the absolute values of the scale-factor differences; deriving first sub-band signals in the respective sub-bands from the bit stream in response to the calculated scale factors; inversely quantizing the first sub-band signals into second sub-band signals in response to the calculated scale factors; and combining the second sub-band signals into an original digital audio signal.
A tenth aspect of this invention provides a method of sub-band decoding for a bit stream generated by the method in third aspect of this invention. The method in the tenth aspect of this invention comprises the steps of detecting selection information in the bit stream; deciding whether the bit stream is of a first format or a second format on the basis of the detected selected information; extracting Huffman-code data from the bit stream when it is decided that the bit stream of the first format; decoding the extracted Huffman-code data into data representative of absolute values of scale-factor differences; extracting sign bits from the bit stream when it is decided that the bit stream of the first format; calculating first scale factors of respective sub-bands on the basis of the extracted sign bits and the data representative of the absolute values of the scale-factor differences; extracting information flags from the bit stream when it is decided that the bit stream is of the second format; extracting selected-scale-factor data from the bit stream when it is decided that the bit stream is of the second format; calculating second scale factors of respective sub-bands on the basis of the extracted information flags and the extracted selected-scale-factor data; deriving first sub-band signals in the respective sub-bands from the bit stream in response to the first scale factors or the second scale factors; inversely quantizing the first sub-band signals into second sub-band signals in response to the first scale factors or the second scale factors; and combining the second sub-band signals into an original digital audio signal.
An eleventh aspect of this invention provides a method of sub-band decoding for a bit stream generated by the method in the fourth aspect of this invention. The method in the eleventh aspect of this invention comprises the steps of detecting selection information in the bit stream; deciding whether the bit stream is of a first format or a second format on the basis of the detected selected information; extracting Huffman-code data from the bit stream when it is decided that the bit stream of the first format; decoding the extracted Huffman-code data into data representative of absolute values of scale-factor differences; extracting sign bits from the bit stream when it is decided that the bit stream of the first format; calculating first scale factors of respective sub-band groups on the basis of the extracted sign bits and the data representative of the absolute values of the scale-factor differences; extracting information flags from the bit stream when it is decided that the bit stream is of the second format; extracting selected-scale-factor data from the bit stream when it is decided that the bit stream is of the second format; calculating second scale factors of the respective sub-band groups on the basis of the extracted information flags and the extracted selected-scale-factor data; deriving first sub-band signals in the respective sub-bands from the bit stream in response to the first scale factors or the second scale factors; inversely quantizing the first sub-band signals into second sub-band signals in response to the first scale factors or the second scale factors; and combining the second sub-band signals into an original digital audio signal.
A twelfth aspect of this invention is based on the eighth aspect thereof, and provides a method wherein the Huffman-code data comprise run-length Huffman code data.
A thirteenth aspect of this invention provides a sub-band coding apparatus comprising means for dividing an input digital audio signal into sub-band signals in respective sub-bands; means for determining scale factors of the respective sub-bands on the basis of the sub-band signals for every frame; means for calculating differences between the determined scale factors for a first frame and the determined scale factors for a second frame preceding the first frame; means for calculating absolute values of the calculated scale-factor differences and generating data representative of the calculated absolute values; means for encoding the data representative of the calculated absolute values into data of a variable-length code; means for generating sign bits representing signs of the calculated scale-factor differences; means for quantizing the sub-band signals in response to the determined scale factors for every frame to generate quantized samples of the sub-band signals; and means for combining the variable-length-code data, the generated sign bits, and the quantized samples of the sub-band signals into a bit stream.
A fourteenth aspect of this invention provides a sub-band coding apparatus comprising means for dividing an input digital audio signal into sub-band signals in respective sub-bands; means for separating the sub-bands into groups on the basis of a perceptual model; means for determining scale factors of the respective sub-band groups on the basis of the sub-band signals for every frame; means for calculating differences between the determined scale factors for a first frame and the determined scale factors for a second frame preceding the first frame; means for calculating absolute values of the calculated scale-factor differences and generating data representative of the calculated absolute values; means for encoding the data representative of the calculated absolute values into data of a variable-length code; means for generating sign bits representing signs of the calculated scale-factor differences; means for quantizing the sub-band signals in response to the determined scale factors for every frame to generate quantized samples of the sub-band signals; and means for combining the variable-length-code data, the generated sign bits, and the quantized samples of the sub-band signals into a bit stream.
A fifteenth aspect of this invention provides a sub-band coding apparatus comprising means for dividing an input digital audio signal into sub-band signals in respective sub-bands; means for determining scale factors of the respective sub-bands on the basis of the sub-band signals for every frame; means for calculating differences between the determined scale factors for a first frame and the determined scale factors for a second frame preceding the first frame; means for calculating absolute values of the calculated scale-factor differences and generating data representative of the calculated absolute values; means for encoding the data representative of the calculated absolute values into data of a variable-length code; means for generating sign bits representing signs of the calculated scale-factor differences; means for generating information flags indicating whether or not the determined scale factors for the first frame are updated from the determined scale factors for the second frame, respectively; means for selecting one or more of the scale factors in the first frame which are updated from those in the second frame, and generating selected-scale-factor data representative of the selected scale factor or the selected scale factors; means for calculating a first sum of a total number of bits of the variable-length-code data and a total number of bits of the sign bits; means for calculating a second sum of a total number of bits of the information flags and a total number of bits of the selected-scale-factor data; means for deciding whether or not the first sum is smaller than the second sum; means for generating selection information in accordance with a result of the deciding whether or not the first sum is smaller than the second sum; means for quantizing the sub-band signals in response to the determined scale factors for every frame to generate quantized samples of the sub-band signals; means for combining the generated selection information, the variable-length-code data, the generated sign bits, and the quantized samples of the sub-band signals into a bit stream when it is decided that the first sum is smaller than the second sum; and means for combining the generated selection information, the generated information flags, the selected-scale-factor data, and the quantized samples of the sub-band signals into a bit stream when it is decided that the first sum is not smaller than the second sum.
A sixteenth aspect of this invention provides a sub-band coding apparatus comprising means for dividing an input digital audio signal into sub-band signals in respective sub-bands; means for separating the sub-bands into groups on the basis of a perceptual model; means for determining scale factors of the respective sub-band groups on the basis of the sub-band signals for every frame; means for calculating differences between the determined scale factors for a first frame and the determined scale factors for a second frame preceding the first frame; means for calculating absolute values of the calculated scale-factor differences and generating data representative of the calculated absolute values; means for encoding the data representative of the calculated absolute values into data of a variable-length code; means for generating sign bits representing signs of the calculated scale-factor differences; means for generating information flags indicating whether or not the determined scale factors for the first frame are updated from the determined scale factors for the second frame, respectively; means for selecting one or more of the scale factors in the first frame which are updated from those in the second frame, and generating selected-scale-factor data representative of the selected scale factor or the selected scale factors; means for calculating a first sum of a total number of bits of the variable-length-code data and a total number of bits of the sign bits; means for calculating a second sum of a total number of bits of the information flags and a total number of bits of the selected-scale-factor data; means for deciding whether or not the first sum is smaller than the second sum; means for generating selection information in accordance with a result of the deciding whether or not the first sum is smaller than the second sum; means for quantizing the sub-band signals in response to the determined scale factors for every frame to generate quantized samples of the sub-band signals; means for combining the generated selection information, the variable-length-code data, the generated sign bits, and the quantized samples of the sub-band signals into a bit stream when it is decided that the first sum is smaller than the second sum; and means for combining the generated selection information, the generated information flags, the selected-scale-factor data, and the quantized samples of the sub-band signals into a bit stream when it is decided that the first sum is not smaller than the second sum.
A seventeenth aspect of this invention provides a sub-band decoding apparatus comprising means for extracting variable-length-code data from a bit stream; means for decoding the extracted variable-length-code data into data representative of absolute values of scale-factor differences; means for extracting sign bits from the bit stream; means for calculating scale factors of respective sub-bands on the basis of the extracted sign bits and the data representative of the absolute values of the scale-factor differences; means for deriving first sub-band signals in the respective sub-bands from the bit stream in response to the calculated scale factors; means for inversely quantizing the first sub-band signals into second sub-band signals in response to the calculated scale factors; and means for combining the second sub-band signals into an original digital audio signal.
An eighteenth aspect of this invention provides a sub-band decoding apparatus comprising means for extracting variable-length-code data from a bit stream; means for decoding the extracted variable-length-code data into data representative of absolute values of scale-factor differences; means for extracting sign bits from the bit stream; means for calculating scale factors of respective sub-band groups on the basis of the extracted sign bits and the data representative of the absolute values of the scale-factor differences; means for deriving first sub-band signals in the respective sub-bands from the bit stream in response to the calculated scale factors; means for inversely quantizing the first sub-band signals into second sub-band signals in response to the calculated scale factors; and means for combining the second sub-band signals into an original digital audio signal.
A nineteenth aspect of this invention provides a sub-band decoding apparatus comprising means for detecting selection information in a bit stream; means for deciding whether the bit stream is of a first format or a second format on the basis of the detected selected information; means for extracting variable-length-code data from the bit stream when it is decided that the bit stream of the first format; means for decoding the extracted variable-length-code data into data representative of absolute values of scale-factor differences; means for extracting sign bits from the bit stream when it is decided that the bit stream of the first format; means for calculating first scale factors of respective sub-bands on the basis of the extracted sign bits and the data representative of the absolute values of the scale-factor differences; means for extracting information flags from the bit stream when it is decided that the bit stream is of the second format; means for extracting selected-scale-factor data from the bit stream when it is decided that the bit stream is of the second format; means for calculating second scale factors of respective sub-bands on the basis of the extracted information flags and the extracted selected-scale-factor data; means for deriving first sub-band signals in the respective sub-bands from the bit stream in response to the first scale factors or the second scale factors; means for inversely quantizing the first sub-band signals into second sub-band signals in response to the first scale factors or the second scale factors; and means for combining the second sub-band signals into an original digital audio signal.
A twentieth aspect of this invention provides a sub-band decoding apparatus comprising means for detecting selection information in a bit stream; means for deciding whether the bit stream is of a first format or a second format on the basis of the detected selected information; means for extracting variable-length-code data from the bit stream when it is decided that the bit stream of the first format; means for decoding the extracted variable-length-code data into data representative of absolute values of scale-factor differences; means for extracting sign bits from the bit stream when it is decided that the bit stream of the first format; means for calculating first scale factors of respective sub-band groups on the basis of the extracted sign bits and the data representative of the absolute values of the scale-factor differences; means for extracting information flags from the bit stream when it is decided that the bit stream is of the second format; means for extracting selected-scale-factor data from the bit stream when it is decided that the bit stream is of the second format; means for calculating second scale factors of the respective sub-band groups on the basis of the extracted information flags and the extracted selected-scale-factor data; means for deriving first sub-band signals in the respective sub-bands from the bit stream in response to the first scale factors or the second scale factors; means for inversely quantizing the first sub-band signals into second sub-band signals in response to the first scale factors or the second scale factors; and means for combining the second sub-band signals into an original digital audio signal.